package com.example.test.entity.common;


import com.example.test.enums.ExceptionEnum;
import com.example.test.enums.MessageEnum;

/**
 * @Author decent
 * @Create 2021/4/13 - 18:55
 * @Description
 */

public class MyException extends RuntimeException{

    private Integer code;

    public MyException() {
    }

    public MyException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public MyException(ExceptionEnum exceptionEnum) {
        super(exceptionEnum.getMessage());
        this.code = exceptionEnum.getCode();
    }

    public MyException(MessageEnum messageEnum) {
        super(messageEnum.getMsg());
        this.code = messageEnum.getStatus();
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
